<template>
  <div id="app">
    <div class="zuopinbox">
      <div class="zuopintitle">
        <span>{{ username1 }}的作品</span>
        (<span @click="fn2">查看全部作品</span>)
      </div>
      <ul class="zuopin">
        <li v-for="item in myarr1">
          <img :src="item.img" alt="" />
          <p>{{ item.title }}</p>
          <div class="tip">{{ item.tip }}</div>
          <div class="bot">
            <span>{{ item.pushtime }}</span>
            <span>{{ item.zan }}</span>
            <span>{{ item.pinglun }}</span>
          </div>
        </li>
      </ul>
    </div>
    <div class="caipubox">
      <div class="caiputitle">
        <span>{{ username1 }}的菜谱</span>
        (<span @click="fn">查看全部菜谱</span>)
      </div>
      <ul class="caipu">
          <li v-for="item in myarr2" :data-caipuid="item.id">
              <img :src="item.img" alt="" @click="shipugo1">
              <p  @click="shipugo1">{{item.title}}</p>
              <div>
                  <span>{{item.shoucang}} 收藏</span>
                  <span>{{username1}}</span>
              </div>
          </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  props: ["username1",'myarr1','myarr2'],
  data() {
    return {
    };
  },
  methods: {
    fn(){
      this.$emit('shipu')
    },
    fn2(){
      this.$emit('zuopin')
    },
    shipugo1(e){
      this.$router.push({  path: `/menudetail/${e.target.parentNode.dataset.caipuid}` });
    }
  },
};
</script>


<style scoped='true'>
* {
  margin: 0;
  padding: 0;
}
li{
    list-style-type:none
}
#app{
  min-height: 300px;
}
.zuopinbox {
  overflow: hidden;
  margin-bottom: 40px;
}
.zuopintitle {
  margin-bottom: 20px;
}
.zuopintitle span:first-child,.caiputitle span:first-child  {
  font-size: 20px;
  font-weight: 700;
  margin-right: 15px;
}
.zuopintitle span:last-child,.caiputitle span:last-child {
  overflow: hidden;
  color: #dd3915;
  font-size: 12px;
  cursor: pointer;
}
.zuopintitle span:last-child:hover,.caiputitle span:last-child:hover {
  background-color: #dd3915;
  color: white;
}
.zuopin,.caipu {
  width: 1080px;
  overflow: hidden;
}
.zuopin li {
  width: 277px;
  height: 435px;
  margin: 0 80px 30px 0;
  float: left;
  border: 1px solid #f3f3f3;
}
.zuopin li img {
  width: 277px;
  height: 280px;
}
.zuopin li p {
  margin: 10px;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  color: #dd3915;
  cursor: pointer;
}
.zuopin li p:hover {
  background-color: #dd3915;
  color: white;
}
.zuopin li .tip {
  color: #333;
  margin: 10px;
  height: 63px;
  overflow: hidden;
}
.zuopin li .bot span {
  font-size: 12px;
  color: #909090;
}
.zuopin li .bot span:nth-child(1) {
  margin: 0 125px 0 10px;
}
.zuopin li .bot span:nth-child(2) {
  margin-right: 20px;
}
.caiputitle{
  margin-bottom:20px;
}
.caipu li {
  width: 277px;
  /* height: 435px; */
  margin: 0 80px 30px 0;
  float: left;
  border: 1px solid #f3f3f3;
}
.caipu li img {
  width: 277px;
  height: 216px;
}
.caipu li p{
    margin: 10px ;
    white-space: nowrap;
  overflow: hidden;
      font-size: 16px;
      cursor: pointer;
}
.caipu li p:hover{
    color: #dd3915;
}
.caipu li div{
    margin: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    padding-bottom: 7px;
}
.caipu li div span{
    color: #909090;
    padding:0 7px;
    font-size: 12px;
}
.caipu li div span:first-child{
   padding:0 7px 0 0;
    border-right: 1px solid #909090;
}
.caipu li div span:last-child:hover{
    cursor: pointer;
    background-color: rgb(44, 44, 44);
    color:#ccc ;
}
</style>